package Games;

import java.util.ArrayList;
import java.util.HashMap;

import Client.GraphicPiece;

public class GamesModel {
	
    private String playerOne;
    private String playerTwo;
    private String currentPlayer;
    private String us;
    private String them;

    private String selectedGame;

    protected Board board;
    protected BoardCanvas boardCanvas;
    private static ArrayList<GraphicPiece> graphicPieces; 
    private HashMap<String, Integer> players;

    public GamesModel(Board board,String selectedGame){
        this.board = board;
        graphicPieces = new ArrayList<GraphicPiece>();
        players = new HashMap<String, Integer>();
        this.selectedGame = selectedGame;
    }

    public Board getBoard() {
            return this.board;
    }

    public ArrayList<GraphicPiece> getGraphicPieces() {
            return graphicPieces;
    }

    public HashMap<String, Integer> getPlayersHashMap() {
            return players;
    }

    public void setPlayerOne(String playerOne) {
            this.playerOne = playerOne;
            players.put(playerOne,0);
    }
        
    public String getPlayerOne() {
        return playerOne;
    }
	
    public void setPlayerTwo(String playerTwo) {
            this.playerTwo = playerTwo;
            players.put(playerTwo,1);
    }

    public String getSelectedGame() {
            return selectedGame;
    }

    public String getCurrentPlayer() {
            return currentPlayer;
    }

    public void setCurrentPlayer(String player) {
            currentPlayer = player;
    }

    public String getPlayerTwo() {
        return playerTwo;
    }
    
    public String getUs() {
        return us;
    }
    
    public void setUs(String us) {
        this.us = us;
    }
    
    public String getThem() {
        return them;
    }
    
    public void setThem(String them) {
        this.them = them;
    }
    
    private void clearBoard() {
        getBoard().clearBoard();
    }

    public void reset() {
        clearBoard();
        setCurrentPlayer(null);
        setPlayerOne(getUs());
        setUs(null);
        setThem(null);
        setPlayerTwo(null);
    }
}
